<%@ page language="java" import="java.sql.*" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<center><body>
<style type="text/css">
  body{background-image:url(tp/jj.jpg);
       background-size:cover;
  }
  </style>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>搜索所选课程</title>
</head>

<body>
<form>
<% 

    request.setCharacterEncoding("utf-8");
    Connection con;
    ResultSet rs;
    String driver = "com.mysql.jdbc.Driver";  
    String url = "jdbc:mysql://127.0.0.1/warehouse?useUnicode=true&characterEncoding=utf-8";  
    String use = "root";   
    String password = ""; 
    String na=session.getAttribute("na").toString();
    Class.forName(driver);  
    Connection conn= DriverManager.getConnection(url,use,password);  
    String[] name=request.getParameterValues("sz");
    PreparedStatement sql =conn.prepareStatement("insert into course(con1,con2,con3,yhm)values(?,?,?,?)");
    sql.setString(1,name[0]);
    sql.setString(2,name[1]); 
    sql.setString(3,name[2]);
    sql.setString(4, na);
    int rtn=sql.executeUpdate();
    sql.close();
    conn.close();
    response.sendRedirect("jiansuo.jsp");
    %>
    
</body>
</html>